import requests

file = open("test.txt", "w+",encoding="utf-8")
file.write("hello world")
print(file.read())
with open("test.txt", "r+",encoding="utf-8") as file:
    print(file.read())
# 获取tpshop登录图片验证码接口数据
response = requests.get("https://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify&r=0.27888225669474687")
file=open("code.png","wb")
file.write(response.content)
file.close()